QuickOPC User's Guide and Reference
Examples - User Interface - Computer browser dialog
View with Navigation Tools

.NET

// This example shows how to let the user browse for computers on the network.

using System.Windows.Forms;
using OpcLabs.BaseLib.Forms.Browsing.Specialized;

namespace UAFormsDocExamples._ComputerBrowserDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var computerBrowserDialog = new ComputerBrowserDialog();

            DialogResult dialogResult = computerBrowserDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            MessageBox.Show(owner, computerBrowserDialog.SelectedName);
        }
    }
}

COM

// This example shows how to let the user browse for computers on the network.

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "ShowDialog.h"

namespace _ComputerBrowserDialog
{
    void ShowDialog::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            // 
            _ComputerBrowserDialogPtr DialogPtr(__uuidof(ComputerBrowserDialog));

            // 
            DialogResult dialogResult = DialogPtr->ShowDialog(NULL);
            _tprintf(_T("%d\n"), dialogResult);
            
            if (dialogResult == 1/*OK*/)
            {
                // Display results
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(DialogPtr->SelectedName));
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}

 

See Also

Conceptual